﻿
@{
    ViewBag.Title = "商品规格";
}
@section CSS{
    <link href="~/Content/css/layerui/layui.css" rel="stylesheet" />
    <link href="~/Content/css/goods.css" rel="stylesheet" />
}
<div class="content-wrapper">
    <section class="content-header">
        <h1>
            设置
            <small>商品规格</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
            <li><a href="#">商品管理</a></li>
            <li><a href="#">商品列表</a></li>
            <li class="active">设置商品规格</li>
        </ol>
    </section>
    <section class="content">
        <div class="row">
            <div class="col-md-12">
                <div class="nav-tabs-custom">
                    <ul class="nav nav-tabs">
                        <li class=""><a href="/goods/editgoods/@ViewBag.id">基本信息</a></li>
                        <li class="active"><a href="/goods/setGoodsSpec/@ViewBag.id" data-toggle="tab" aria-expanded="true">商品规格</a></li>
                        <li class=""><a href="/goods/GoodsSku/@ViewBag.id">商品SKU</a></li>
                    </ul>
                    <div class="box">
                        <div class="box-body">
                            <div class="ibox float-e-margins">
                                <div class="ibox-content  contenttab1" id="g_spec">
                                    <form class="form-horizontal" id="from-add">
                                        <div class="form-group" id="form-group-one" style="display:none;">
                                            <label class="col-sm-2 control-label lab_red" id="lab_one"></label>
                                            <input id="spec_id_one" type="hidden" value="0" />
                                            <div class="col-sm-10 table-responsive">
                                                <button type="button" class="btn btn-default" id="del_spec_one" style="display:none;" onclick="delSpe(1)">删除该规格类型</button>
                                                <button type="button" class="btn btn-default" id="add_spec_one" style="display:none;" onclick="return addOneSpec();"><i class="fa fa-plus">添加规格</i></button>
                                                <ul class="my_spec_ul" id="my_spec_one"></ul>
                                                <span style="clear:both;" class="help-block m-b-none">目前支持第一个规格可设置图片，设置图片后用户选择不同规格会显示不同图片</span>
                                            </div>
                                        </div>
                                        <div class="form-group" id="form-group-two" style="display:none;">
                                            <label class="col-sm-2 control-label lab_red" id="lab_two"></label>
                                            <input id="spec_id_two" type="hidden" value="0" />
                                            <div class="col-sm-10 table-responsive">
                                                <button type="button" class="btn btn-default" id="del_spec_two" style="display:none;" onclick="delSpe(2)">删除该规格</button>
                                                <button type="button" class="btn btn-default" id="add_spec_two" style="display:none;" onclick="return addTwoSpec();"><i class="fa fa-plus">添加规格</i></button>
                                                <ul class="my_spec_ul" id="my_spec_two"></ul>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">选择/输入规格</label>
                                            <div class="col-sm-10">
                                                <select style="width: 120px; height: 35px;float:left;margin-right:5px;" id="goods_spec">
                                                    <option value="-1">-请选择规格-</option>
                                                    <option value="0">-其他-</option>
                                                    <option value="1">颜色</option>
                                                    <option value="2">尺码</option>
                                                </select>
                                                <input style="width:120px;float:left;margin-right:10px;display:none;" id="my_spec" value="" type="text" class="form-control" placeholder="其他规格" />
                                                @*<label style="width:80px;float:left;margin-right:5px;" id="lab_has_img"><input type="checkbox" style="margin-top:10px;" id="has_img">是否有图</label>*@
                                                <button type="button" style="float:left;" onclick="return addSpec()" class="btn btn-default" id="add_spec"><i class="fa fa-plus">添加规格类型</i></button>
                                                <span style="clear:both;" class="help-block m-b-none">多个规格类型，请点击“添加规格类型”添加，最多可添加2个规格类型</span>
                                            </div>
                                        </div>


                                        <div class="form-group">
                                            <div class="col-sm-4 col-sm-offset-2">
                                                <button class="btn btn-danger" type="button" id="btnMake" style="display:none;" onclick="makeSku();">下一步，设置价格及库存</button>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

</div>
@section JS{

    <script>
        var _id = @ViewBag.id;
        var spec_num=0;
        var spec_ul_one_li=0;
        var group_one=false;
        var spec_ul_two_li=0;
        var group_two=false;
        $(function () {
            get_spec_list();
            if (_id != undefined) {
                initSpec(_id);
            }
            $("#goods_spec").change(function () {
                var _mId = $(this).val();
                if (_mId == "0") {
                    $("#my_spec").val("").show();
                }
                else {
                    $("#my_spec").hide();
                }
            });
        })

    </script>
    <script src="~/Content/js/GoodsSpec.js"></script>
}



